package glog

import (
	"gonexample/gone/config"

	"github.com/donnie4w/go-logger/logger"
)

func SetLogger(name string) {
	// logger.SetConsole(true)

	// 日志按文件大小存放
	// logger.SetRollingFile(config.App.LogSavePath, name+".log", 30, 40, logger.MB)

	// 设置日志记录最低级别
	logger.SetLevel(logger.DEBUG)

	// 设置按日期存放
	logger.SetRollingDaily(config.App.LogSavePath+name, name+".log")

}

func Debug(logFormat string, v ...interface{}) {
	logger.SetFormat(logFormat)
	logger.Debug(v...)
}

func Info(logFormat string, v ...interface{}) {
	logger.SetFormat(logFormat)
	logger.Info(v...)
}

func Warn(logFormat string, v ...interface{}) {
	logger.SetFormat(logFormat)
	logger.Warn(v...)
}

func Error(logFormat string, v ...interface{}) {
	logger.SetFormat(logFormat)
	logger.Error(v...)
}

func Fatal(logFormat string, v ...interface{}) {
	logger.SetFormat(logFormat)
	logger.Fatal(v...)
}
